"""
功能描述 ：
编写人 ：
编写日期 ：
实现逻辑 ：
    1- ......
        1.1- ......
    2- ......
        2.1- ......
"""
# #面向对象继承
# class Fu():
#     def __init__(self):
#         self.num = 1
#     def info_print(self):
#         print(self.num)
# class Zi(Fu):
#     pass
# a = Zi()
# a.info_print()
# #单继承
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
# class Perntice(Master): #徒弟类
#     pass
# xiaoming = Perntice()
# print(xiaoming.kongfu)
# xiaoming.make_cake()
# #多继承
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     pass
#
# xiaoming = Perntice()
# print(xiaoming.kongfu)
# xiaoming.make_cake()
#
# #⼦类重写⽗类同名⽅法和属性
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     def __init__(self):
#         self.kongfu = ['独创煎饼果子']
#     def Make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')

# xiaoming = Perntice()
# print(xiaoming.kongfu)
# xiaoming.make_cake()
# print(Perntice.__mro__)

#⼦类调⽤⽗类的同名⽅法和属性
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     def __init__(self):
#         self.kongfu = '[独创煎饼果子 ]'
#     def make_cake(self):
#         self.__init__()
#         print(f'运用{self.kongfu}制作煎饼果子')
#     def make_master_cake(self):
#         Master.__init__(self)
#         Master.make_cake(self)
#     def make_school_cake(self):
#         School.__init__(self)
#         School.make_cake(self)
# #
# xiaoming = Perntice()
# xiaoming.make_cake()
# xiaoming.make_school_cake()
# xiaoming.make_master_cake()
# xiaoming.make_cake()
# #
# # 多层继承
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     def __init__(self):
#         self.kongfu = '[独创煎饼果子 ]'
#     def make_cake(self):
#         self.__init__()
#         print(f'运用{self.kongfu}制作煎饼果子')
#     def make_master_cake(self):
#         Master.__init__(self)
#         Master.make_cake(self)
#     def make_school_cake(self):
#         School.__init__(self)
#         School.make_cake(self)
#
# class Tusun(Perntice):
#     pass
# xm = Tusun()
# xm.make_cake()
# xm.make_master_cake()
# xm.make_school_cake()
# # super()调⽤⽗类⽅法
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#         super.__init__()
#         super.make_cake()
# class Perntice(School,Master):
#
#     def __init__(self):
#          self.kongfu = '[独创煎饼果子 ]'
#     def make_cake(self):
#          self.__init__()
#          print(f'运用{self.kongfu}制作煎饼果子')
#
#     def make_master_cake(self):
#         Master.__init__(self)
#         Master.make_cake(self)
#     def make_school_cake(self):
#         School.__init__(self)
#         School.make_cake(self)
#     def make_old_cake(self):
#         super.__init__(self)
#         super.make_cake(self)
#
# xm = Perntice()
# xm.make_old_cake()

# # 定义私有属性和⽅法
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     def __init__(self):
#         self.kongfu = '[独创煎饼果子 ]'
#         # 定义私有方
#         self.money = 2000000
#         #定义私有方法
#     def __info_print(self):
#         print(self.kongfu)
#         print(self.money)
#
#     def make_cake(self):
#         self.__init__()
#         print(f'运用{self.kongfu}制作煎饼果子')
#
#
#     def make_master_cake(self):
#         Master.__init__(self)
#         Master.make_cake(self)
#     def make_school_cake(self):
#         School.__init__(self)
#         School.make_cake(self)
# class Tusu(Perntice):
#     pass
#
# xh = Tusu()

# 获取和修改私有属性值
# class Master():   #师父类
#     def __init__(self):
#         self.kongfu = ['五香煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class School():  #学校类
#     def __init__(self):
#         self.kongfu = ['香辣煎饼果子']
#     def make_cake(self):
#         print(f'运用{self.kongfu}制作煎饼果子')
#
# class Perntice(School,Master):
#     def __init__(self):
#         self.kongfu = '[独创煎饼果子 ]'
#         self.money = 2000000
#     #获取私有属性
#     def get_money(self):
#         return self.money
#     #修改私有属性
#     def set_money(self):
#         self.money = 500
#     def _info_print(self):
#         print(self.kongfu)
#         print(self._money)
#     def make_cake(self):
#         self.__init__()
#         print(f'运用{self.kongfu}制作煎饼果子')
#     def make_master_cake(self):
#         Master.__init__(self)
#         Master.make_cake(self)
#     def make_school_cake(self):
#         School.__init__(self)
#         School.make_cake(self)
# class Tusun(Perntice):
#     pass
#
# xm = Perntice()
# xg = Tusun()
# print(xg.get_money())
# xg.set_money()
# print(xg.get_money())

#  ⾯向对象三⼤特性
# 封装
# 将属性和⽅法书写到类的⾥⾯的操作即为封装
# 封装可以为属性和⽅法添加私有权限
# 继承
# ⼦类默认继承⽗类的所有属性和⽅法
# ⼦类可以重写⽗类属性和⽅法
# 多态
# 传⼊不同的对象，产⽣不同的结果

# class Dog():
#     def work(self):
#         print('指哪打哪')
# class ArmyDog(Dog):
#     def work(self):
#         print('追击敌人')
# class DrugDog(Dog):
#     def work(self):
#         print('缉毒犬')
# class Person():
#     def work_with_dog(self,dog):
#         dog.work()
#
# ad = ArmyDog()
# dd = DrugDog()
# police = Person()
#
# police.work_with_dog(ad)
# police.work_with_dog(dd)
# #设置和访问类属性
# class Dog():
#     tooth = 10
# wangcai = Dog()
# dahuang = Dog()
#
# print(Dog.tooth)
# print(wangcai.tooth)
# print(dahuang.tooth)
# 修改类属性
# class Dog():
#     tooth = 10
# wangcai = Dog()
# dahuang = Dog()
# #修改
# Dog.tooth = 12
# print(Dog.tooth)
# print(dahuang.tooth)
# print(wangcai.tooth)
#
# wangcai.tooth = 15
# print(wangcai.tooth)
# print(dahuang.tooth)
# print(Dog.tooth)
# 实例属性
class Dog():
    def __init__(self):
        self.age =5
    def info_print(self):
        print(self.age)
wangcai1 = Dog()
print(wangcai1.age)
wangcai1.info_print()
# print(Dog.age)

# 类⽅法特点
# 需要⽤装饰器 @classmethod 来标识其为类⽅法，对于类⽅法，第⼀个参数必须是类对象，⼀般以cls 作为第⼀个参数。
# 类⽅法使⽤场景
# 当⽅法中 需要使⽤类对象 (如访问私有类属性等)时，定义类⽅法
# 类⽅法⼀般和类属性配合使⽤
# class Dog(object):
#     __tooth = 10
#     @classmethod
#     def get_tooth(cls):
#         return cls.__tooth
# wangcai = Dog()
# result = wangcai.get_tooth()
# print(result) # 10
#
# # 静态⽅法使⽤场景
# class Dog():
#     @staticmethod
#     def info_print():
#         print('这是一个狗类，用于创建狗的实例')
#
# wangcai = Dog()
# wangcai.info_print()
# Dog.info_print()

